import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import EmployeeView from '@/views/EmployeeView.vue'
import DepartmentView from '@/views/DepartmentView.vue'
import LayoutView from '@/layout/LayoutView.vue'

const routes: Readonly<RouteRecordRaw[]> = [{
  path: '/',
  name: 'index',
  component: LayoutView,
  redirect: '/department',
  children: [{
    path: '/department',
    name: 'department',
    meta: {
      title: '部门管理'
    },
    component: DepartmentView
  }, {
    path: '/employee',
    name: 'employee',
    meta: {
      title: '员工管理'
    },
    component: EmployeeView
  }]
}]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
